package com.fdb.basic.framework.core.constant;

import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 角色权限枚举类，权限体系共五级，包括如下：<br>
 * LEVEL_ONE:当前用户<br>
 * LEVEL_TWO:当前用户及所属机构<br>
 * LEVEL_THREE:当前用户所在机构及下属机构<br>
 * LEVEL_FOUR:预留，便于后续自定义<br>
 * LEVEL_FIVE:预留，便于后续自定义<br>
 * 
 * @author ligm
 * @since 2019年3月5日 下午3:25:09
 * @version 1.0
 */
public enum DataRuleType {
    

    Owner("01"), CurrOrg("02"), CurrDownOrg("03"),CurrOwnerPrd("04");

    private String value;
    
    private DataRuleType(String value) {
        this.value = value;
    }
    
    public String getValue() {
        return this.value;
    }
    
    private static Map<String, DataRuleType> typeMapper = new ConcurrentHashMap<>(DataRuleType.values().length);
    
    static {
        Arrays.stream(DataRuleType.values()).forEach(s -> typeMapper.put(s.getValue(), s));
    }
    
    public final static DataRuleType getDataRuleType(String dataRuleType) {
		if (null == dataRuleType)
			return DataRuleType.Owner;
		if (typeMapper.containsKey(dataRuleType)) {
			return typeMapper.get(dataRuleType);
		}
		return DataRuleType.Owner;
    }
        
}
